<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>VUE</title>
</head>
<body>
<div id="app-5">
    <p>{{ message }}</p>
    <button v-on:click="reverseMessage">反转消息</button>
    <button @dblclick="reverseMessage">反转消息</button>
<!--    <button onclick="app5.reverseMessage()">反转消息</button>-->
</div>

<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app5 = new Vue({
        el: '#app-5',
        data: {
            message: 'abcd'
        },
        methods: {
            reverseMessage: function () {
                this.message = this.message.split('').reverse().join('')
            }
        }
    })
</script>


</body>
</html>